﻿<UserControl x:Class="Atlanchim.Crm.Mui.Pages.Societes.PageListSocietes"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mui="http://firstfloorsoftware.com/ModernUI"
             xmlns:lmondeilConverters="clr-namespace:Atlanchim.Crm.Mui.Pages.Societes"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid Style="{StaticResource ContentRoot}">
        <ScrollViewer>
            <StackPanel MinWidth="200">

                <!--Entête-->
                <TextBlock Text="{Binding Title, FallbackValue=Clients ou Prospects}" Style="{StaticResource Heading2}" />

                <!--Boutons d'actions-->
                <mui:ModernButton Content="Ajouter"
                                  Command="NavigationCommands.GoToPage" CommandParameter="/Pages/Societes/PageEditSociete.xaml#IdSociete=0"
                                  IconData="{StaticResource ResourceKey=LmondeilAddButtonPath}" Foreground="{StaticResource ResourceKey=LmondeilAddButtonColor}"/>

                <!--Liste-->
                <DataGrid ItemsSource="{Binding SocietesList}" AutoGenerateColumns="False"
                      CanUserResizeColumns="True" CanUserSortColumns="True">
                    <DataGrid.Columns>
                        <DataGridTemplateColumn Header="Nom" IsReadOnly="True" SortMemberPath="Nom" Width="*" HeaderStyle="{DynamicResource headerStyle}">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <Button Padding="0"
                                    Command="NavigationCommands.GoToPage" CommandParameter="{Binding Converter={lmondeilConverters:SocieteToViewUrlConverter}}" HorizontalContentAlignment="Stretch" BorderBrush="{x:Null}" Background="{x:Null}" >
                                        <TextBlock Text="{Binding Nom}" />
                                    </Button>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                        <DataGridTemplateColumn Header="Sect. Act." IsReadOnly="True" SortMemberPath="SecteurActivite" Width="*" HeaderStyle="{DynamicResource headerStyle}">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <Button Padding="0"
                                    Command="NavigationCommands.GoToPage" CommandParameter="{Binding Converter={lmondeilConverters:SocieteToViewUrlConverter}}" HorizontalContentAlignment="Stretch" BorderBrush="{x:Null}" Background="{x:Null}" >
                                        <TextBlock Text="{Binding SecteurActivite}" />
                                    </Button>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                        <DataGridTemplateColumn Header="Pays" IsReadOnly="True" SortMemberPath="Pays" Width="*" HeaderStyle="{DynamicResource headerStyle}">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <Button Padding="0"
                                    Command="NavigationCommands.GoToPage" CommandParameter="{Binding Converter={lmondeilConverters:SocieteToViewUrlConverter}}" HorizontalContentAlignment="Stretch" BorderBrush="{x:Null}" Background="{x:Null}" >
                                        <TextBlock Text="{Binding Pays}" />
                                    </Button>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                        <DataGridTemplateColumn Header="Type" IsReadOnly="True" SortMemberPath="Type" Width="*" HeaderStyle="{DynamicResource headerStyle}">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <Button Padding="0"
                                    Command="NavigationCommands.GoToPage" CommandParameter="{Binding Converter={lmondeilConverters:SocieteToViewUrlConverter}}" HorizontalContentAlignment="Stretch" BorderBrush="{x:Null}" Background="{x:Null}" >
                                        <TextBlock Text="{Binding Type}" />
                                    </Button>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                    </DataGrid.Columns>
                </DataGrid>
            </StackPanel>
        </ScrollViewer>
    </Grid>
</UserControl>
